<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ include file="/WEB-INF/view/include.jsp"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page import="ae.pcfc.etks.online.itworx.ehs.web.constants.GlobalConstants"%>
<%@page import="ae.pcfc.etks.online.itworx.ehs.web.entity.Request"%>
<%@page import="ae.pcfc.etks.online.itworx.ehs.web.enums.RequestField"%>
<%@page import="ae.pcfc.etks.online.itworx.ehs.web.enums.RequestStatus"%>

<script type="text/javascript">
	
</script>
<form:form modelAttribute="<%=GlobalConstants.TRAKHEES_REQUEST_PARAMETER%>"
	name="selectTksUsers" id="selectTksUsers" method="POST"
	action='officer/selectTksUsers.htm'
	enctype="text/html">

	<div class="error_msg">
		<spring:bind path="trakheesRequestParameter.*">
			<c:forEach items="${status.errorMessages}" var="error">
				<c:out value="${error}" />
				<br />
			</c:forEach>
		</spring:bind>
	</div>

	<form:hidden path="sortField" />
	<form:hidden path="assending" />
	<form:hidden path="type" id="type" name="type" />
	<form:hidden path="requestType" />
	<table id="tks_search" class="grdView searchTbl">
		<caption>
			<spring:message code="label.titel.search" />
		</caption>
		<tr>
			<td nowrap="nowrap" style="width: 15%"><label><spring:message code="label.request.trakheesID"/></label>
			</td>
			<td>
				<form:input path="trakheesId" type="text" class="srchTxt" />
				<span class="btn_border">
					<button type="button" class="btn_bg"  onclick='document.forms[0].submit();'><spring:message code="label.allRequests.button" /></button>
				</span>
			</td>
			<td>

			</td>
			<td>
			</td>
		</tr>
	</table>

	<div class="brk"></div>
	<c:choose>
		<c:when test="${( trakheesIdUsers == null) or (empty trakheesIdUsers) }">
			<c:if test="${trakheesId !=null}"> <spring:message code="label.general.noResults" /></c:if>
		</c:when>
		<c:otherwise>
			<table id="trakheesIdUsers" class="grdView">
				<caption>
					<spring:message code="label.titel.selectUser" />
				</caption>
				<colgroup>
					<col width="100%" />
				</colgroup>
				<tr>
					<th>
						<c:choose>
							<c:when test='${requestScope.requestContextAttribute.locale.language eq "ar"}'>
								<a style='cursor: pointer' onclick="doSorting('<%=RequestField.NameArab.getPropertyName()%>');"><spring:message code="label.titel.allTrakheesIdUsers" /></a> 
							</c:when>
							<c:otherwise>
								<a style='cursor: pointer' onclick="doSorting('<%=RequestField.Name.getPropertyName()%>');"><spring:message code="label.titel.allTrakheesIdUsers" /></a>
							</c:otherwise>
						</c:choose>
											
					</th>
				</tr>
				<c:forEach var="user" items="${trakheesIdUsers}" varStatus="loopStatus">
					<tr ${loopStatus.index % 2 == 0 ? 'class="grdAltRow"' : ''}>
						<td>
							<a href="client/create.htm?type=${trakheesRequestParameter.requestType}&userName=${user.userName}">
								<c:out value="${user.userName}" /> 
							</a>
						</td>
					</tr>
				</c:forEach>
			</table>

			<div class="grdPager">
				<c:if test="${!trakheesRequestParameter.firstPage}">

					<a style='cursor: pointer' onclick="doPaginate('1');"> <<
						<spring:message code="label.img.first" /> </a>

					<a style='cursor: pointer'
						onclick="doPaginate('${trakheesRequestParameter.pageNumber-1}');">
						< <spring:message code="label.img.prev" /> </a>
				</c:if>
				<span class="label"> <spring:message code="label.list.pageWord" /> </span>
				<form:input path="pageNumber" type="text" name="pageIndex" 
				id="pageIndex" cssStyle="width:50px;"
					value="${trakheesRequestParameter.pageNumber}"
					onkeypress="jumbToPage(event);" />
				<span class="label"> <spring:message code="label.list.ofWord" />
					${trakheesRequestParameter.totalPageNumber} </span>
				<c:if
					test="${!trakheesRequestParameter.lastPage and trakheesRequestParameter.pageNumber < trakheesRequestParameter.totalPageNumber}">
					<a style='cursor: pointer'
						onclick="doPaginate('${trakheesRequestParameter.pageNumber+1}');">
						<spring:message code="label.img.next" /> > </a>
					<a style='cursor: pointer'
						onclick="doPaginate('${trakheesRequestParameter.totalPageNumber}');">
						<spring:message code="label.img.last" /> >> </a>
				</c:if>

			</div>
		</c:otherwise>
	</c:choose>


</form:form>
